package com.server.llh.llhserverwork.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.bean.UserInfoBena;

import java.util.List;

/**
 * Created by ZTF on 2017-06-14.
 */

public class UserInfoAdapter extends BaseAdapter {
    Context context;
    List<UserInfoBena.DataBean> accountList;
    public UserInfoAdapter(Context context, List<UserInfoBena.DataBean> accountList){
        this.context=context;
        this.accountList=accountList;
    }

    @Override
    public int getCount() {
        if (accountList==null&&accountList.size()==0){
            return  0;
        }
        return accountList.size();
    }

    @Override
    public Object getItem(int position) {
        return accountList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        VierHolder h = new VierHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(
                    R.layout.my_accout_info_item, null);
            h.cardNoBalance = (TextView) convertView.findViewById(R.id.card_banlance);
            h.cardNoTxt = (TextView) convertView.findViewById(R.id.cardName);
            convertView.setTag(h);
        } else {
            h = (VierHolder) convertView.getTag();
        }
        UserInfoBena.DataBean  payQuery= accountList.get(position);
        h.cardNoTxt.setText(""+payQuery.getUserName() );
        return convertView;
    }

    class VierHolder {
        TextView cardNoBalance;
        TextView cardNoTxt;
    }

}
